<%--
  Created by IntelliJ IDEA.
  User: zwj
  Date: 2016/10/6
  Time: 10:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>便民服务平台3.0</title>
    <script>
        var jz = "";

    </script>
</head>

<body>
<jsp:include page="../include/header.jsp?actionId=index_5"/>
<script src="<c:url value='/resource/js/lib/jqPaginator.js?v2.0'/>"></script>

<div class="main-container">
    <div class="mc-hd">
        <p class="app-t">queryCenter</p>
        <h1 class="app-h1">专注高端”互联网+政务”设计</h1>
        <div class="type-wrap">
            <h2 class="typedH2">慧眼看世界，在政务服务的路上不断追求创新！</h2>
        </div>
    </div>
    <div class="mc-bd">

        <div class="container">
            <ol class="breadcrumb">
                <li><a href="<c:url value="/interacts"></c:url>">应用中心</a></li>
                <li class="active">表格下载</li>
            </ol>
            <div class="row">
                <div class="col-sm-12">
                    <div class="mccc-right">
                        <h2>表格下载</h2>
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <label>事项名称：</label>
                                <input type="text" id="mattername" value="" maxlength="50"
                                       class="form-control" placeholder="请输入事项名称" style="margin-left:10px">
                            </div>
                            <div class="form-group" style="margin-left:20px">
                                <label>表单名称：</label>
                                <input type="text" id="formname" value="" maxlength="50" style="margin-left:10px"
                                       class="form-control" placeholder="请输入表单名称">
                            </div>
                            <div class="form-group">
                                <button type="button" id="btnsearch" class="btn btn-blue">查询
                                </button>
                            </div>
                        </div>
                        <dl class="download-category" style="margin-top:10px">
                            <dt style="margin-left:23px">警种：</dt>
                            <c:forEach items="${pcc}" var="dict" varStatus="vs">
                                <dd id="pcc_${dict.id}" onclick="caseJz('${dict.id}',20,1)"><a
                                        style="cursor: pointer">${dict.value}</a></dd>
                                <c:if test="${vs.count==1}">
                                    <script>
                                        //$('#pcc_${dict.id}').addClass("active");
                                        //caseJz('${dict.id}');
                                        jz = '${dict.id}';
                                    </script>
                                </c:if>
                            </c:forEach>
                            <input type="hidden" id="hidCurrentSelectPcc"/>
                        </dl>
                        <div id="data-div">
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<jsp:include page="../include/footer.jsp"/>
<script src="<c:url value='/resource/js/require.js'/>" data-main="<c:url value='/resource/js/main'/>" id="current-page"
        current-page="appCenterBillResource"></script>

<script type="text/javascript">
    $(function () {
        caseJz(jz, 20, 1);

        $('#btnsearch').click(function () {
            search($('#mattername').val(), $('#formname').val());
        });
    });

    function search() {

        var url = '<c:url value='/interacts/billresource/page'/>?ps=' + 20
                + '&pi=' + 1
                + '&q_pcc_s_eq=' + $('#hidCurrentSelectPcc').val()
                + '&q_mat_name_s_lk=' + $('#mattername').val()
                + '&q_item_name_s_lk=' + $('#formname').val();
        //加载数据
        $('#data-div').load(url);



    }

    function caseJz(type, pageSize, pageIndex) {

        $('#hidCurrentSelectPcc').val(type);
        //移除全部样式
        //alert(type)
        jz = type;
        $("dd[id*=pcc_]").removeClass("active");
        $("#pcc_" + type).addClass("active");
//        $("#" + type).siblings().each(function () {
//            $(this).removeClass("active");
//        });

        var url = '<c:url value='/interacts/billresource/page'/>?ps=' + pageSize
                + '&pi=' + 1
                + '&q_pcc_s_eq=' + $('#hidCurrentSelectPcc').val()
                + '&q_mat_name_s_lk=' + $('#mattername').val()
                + '&q_item_name_s_lk=' + $('#formname').val();
        //加载数据
        $('#data-div').load(url);


    }

    function downloadTable(guid, type) {

        $.ajax({
            url: '<c:url value="/matters/ajax-download-check"/>' + "?guid=" + guid + "&type=" + type,
            type: "GET",
            dataType: "json",
            success: function (res) {
                if (res.succ) {
                    window.location.href = '<c:url value="/matters/ajax-download"/>' + "?guid=" + guid + "&type=" + type;
                } else {
                   alert(res.msg);
                }
            },
            error: function (e) {
                //toast(res.msg);
                console.log(e);
            }
        });


    }
</script>
</body>
</html>
